package com.itheima.controller;


import com.itheima.common.R;
import com.itheima.entity.Setmeal;
import com.itheima.entity.SetmealDishes;
import com.itheima.service.SetmealService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**套餐管理接口
 * @author msi
 */
@RestController
@RequestMapping("/setmeal")
public class SetmealControllerM {
    @Resource
    private SetmealService service;

    @GetMapping("/list")
    public R<List<Setmeal>> getList(@RequestParam("categoryId") String categoryId, @RequestParam("status") Integer status) {
        List<Setmeal> list = service.getList(categoryId, status);
        return R.success(list);
    }

    @GetMapping("/dish/{id}")
    public R<List<SetmealDishes>> getSetmealDishes(@PathVariable String id){
        List<SetmealDishes> setmealDishes = service.getSetmealDishes(id);
        return R.success(setmealDishes);
    }

}
